/** 
 * Copyright 2010 Erlacher Felix, Estgfaeller Wolfgang, Ferula Patrick
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package at.socialconference.web.client;

import java.util.List;
import java.util.TreeMap;

import at.socialconference.inter.model.Conference;
import at.socialconference.inter.model.Login;
import at.socialconference.inter.model.Place;
import at.socialconference.inter.model.Talk;
import at.socialconference.inter.model.Updatetable;
import at.socialconference.inter.model.User;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * Defines the methods provided by the GWT webservice
 */
public interface SCwebServiceAsync {
	/**
	 * Login
	 * 
	 * @param user
	 *            Username of the client
	 * @param pwd
	 *            Password of the client
	 */
	public void login(String user, String pwd, AsyncCallback<Integer> callback);

	/**
	 * Logout
	 */
	public void logout(AsyncCallback<Void> callback);

	/**
	 * Registers a user in the database
	 * 
	 * @param user
	 * @param login
	 */
	public void register(User user, Login login, AsyncCallback<Integer> callback);

	public void getClientUser(AsyncCallback<User> callback);

	/**
	 * Get a list of countries
	 */
	public void getCountries(AsyncCallback<TreeMap<Integer, String>> callback);

	/**
	 * Fetches information of the given person from the official DBLP site.
	 * 
	 * @param firstName
	 * @param lastName
	 * @param callback the callback to return A list of DBLP links mapped to a specific name.
	 */
	public void getDBLPLinks(String firstName, String lastName, AsyncCallback<TreeMap<String, String>> callback);

	public void getAuthURL(AsyncCallback<String> callback);

	public void createAccToken(String pin, boolean store, AsyncCallback<Integer> callback);

	public void follow(int id, AsyncCallback<Integer> callback);
	
	public void unFollow(int id, AsyncCallback<Integer> callback);
	
	//TODO rename -> something like TwitterFriends
	public void getFriends(AsyncCallback<String> callback);

	public void getTimelines(AsyncCallback<String> callback);

	public void getConferences(AsyncCallback<List<Conference>> callback);

	public void searchUser(String firstname, String lastname, int countryCode, AsyncCallback<List<User>> callback);

	/**
	 * Checks for a currently open and valid session
	 */
	public void existsValidSession(AsyncCallback<Boolean> callback);
	
	/**
	 * Request friendship with somebody
	 * @param id Id of your friend
	 */
	public void friendRequest(int id, AsyncCallback<Integer> callback);
	
	/**
	 * Fetch the list of current friend requests from other users
	 */
	public void getFriendRequests(AsyncCallback<List<User>> callback);
	
	/**
	 * Accept a friendship request of somebody
	 * @param id Id of the person which requested friendship
	 */
	public void acceptFriendRequest(int id, AsyncCallback<Integer> callback);
	
	/**
	 * Reject a friendship request of somebody
	 * @param id Id of the person which requested friendship
	 */
	public void rejectFriendRequest(int id, AsyncCallback<Integer> callback);
	
	/**
	 * Updates an object in the database
	 * @param object
	 */
	public void updateObject(Updatetable object, AsyncCallback<Integer> callback);
	
	/**
	 * Deletes an object in the database
	 * @param object
	 */
	public void deleteObject(Updatetable object, AsyncCallback<Integer> callback);
	
	/**
	 * Insert an object in the database
	 * @param object
	 */
	public void insertObject(Updatetable object, AsyncCallback<Integer> callback);
	
	public void getPlaces(AsyncCallback<List<Place>> callback);
	
	public void getTalks(AsyncCallback<List<Talk>> callback);
	
	public void isEnrolled(Integer id, AsyncCallback<Boolean> callback);
	
	public void enroll(Integer id, AsyncCallback<Integer> callback);

}
